<%--
  Created by IntelliJ IDEA.
  User: 11935
  Date: 2022/5/5
  Time: 19:21
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>index.jsp</title>
    <script src="/js/jquery-3.4.1.min.js"></script>
</head>
<body>

<button onclick="testOrigin()">跨域测试</button>
</body>
<script>
    function testOrigin() {
        alert(11);

        //ajax
        $.ajax({
            url : 'http://localhost:82/test/origin',
            type : 'POST',
            data: {id:100, name:"jack"},
            dataType : 'json',
            success : function (result) {
                console.log(result);
            },
            error: function () {
                alert("ERROR");
            },
            //允许跨域携带cookie
            xhrFields: {
                withCredentials : true
            }
        });

    }
</script>
</html>
